<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_Universite extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(4)
     *
     * @var int
     */
    protected $_IdUniversite;

    /**
     * Database var type varchar(200)
     *
     * @var string
     */
    protected $_Nom;

    /**
     * Database var type varchar(200)
     *
     * @var string
     */
    protected $_Adresse;

    /**
     * Database var type varchar(50)
     *
     * @var string
     */
    protected $_Email;

    /**
     * Database var type varchar(50)
     *
     * @var string
     */
    protected $_SiteWeb;



    /**
     * Dependent relation fk_etablissement_universite1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Etablissement
     */
    protected $_Etablissement;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'id_universite'=>'IdUniversite',
            'nom'=>'Nom',
            'adresse'=>'Adresse',
            'email'=>'Email',
            'site_web'=>'SiteWeb',
        ));

        $this->setParentList(array(
        ));

        $this->setDependentList(array(
            'FkEtablissementUniversite1' => array(
                    'property' => 'Etablissement',
                    'table_name' => 'Etablissement',
                ),
        ));
    }

    /**
     * Sets column id_universite
     *
     * @param int $data
     * @return Application_Model_Universite
     */
    public function setIdUniversite($data)
    {
        $this->_IdUniversite = $data;
        return $this;
    }

    /**
     * Gets column id_universite
     *
     * @return int
     */
    public function getIdUniversite()
    {
        return $this->_IdUniversite;
    }

    /**
     * Sets column nom
     *
     * @param string $data
     * @return Application_Model_Universite
     */
    public function setNom($data)
    {
        $this->_Nom = $data;
        return $this;
    }

    /**
     * Gets column nom
     *
     * @return string
     */
    public function getNom()
    {
        return $this->_Nom;
    }

    /**
     * Sets column adresse
     *
     * @param string $data
     * @return Application_Model_Universite
     */
    public function setAdresse($data)
    {
        $this->_Adresse = $data;
        return $this;
    }

    /**
     * Gets column adresse
     *
     * @return string
     */
    public function getAdresse()
    {
        return $this->_Adresse;
    }

    /**
     * Sets column email
     *
     * @param string $data
     * @return Application_Model_Universite
     */
    public function setEmail($data)
    {
        $this->_Email = $data;
        return $this;
    }

    /**
     * Gets column email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->_Email;
    }

    /**
     * Sets column site_web
     *
     * @param string $data
     * @return Application_Model_Universite
     */
    public function setSiteWeb($data)
    {
        $this->_SiteWeb = $data;
        return $this;
    }

    /**
     * Gets column site_web
     *
     * @return string
     */
    public function getSiteWeb()
    {
        return $this->_SiteWeb;
    }

    /**
     * Sets dependent relations fk_etablissement_universite1
     *
     * @param array $data An array of Application_Model_Etablissement
     * @return Application_Model_Universite
     */
    public function setEtablissement(array $data)
    {
        $this->_Etablissement = array();

        foreach ($data as $object) {
            $this->addEtablissement($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_etablissement_universite1
     *
     * @param Application_Model_Etablissement $data
     * @return Application_Model_Universite
     */
    public function addEtablissement(Application_Model_Etablissement $data)
    {
        $this->_Etablissement[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_etablissement_universite1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Etablissement
     */
    public function getEtablissement($load = true)
    {
        if ($this->_Etablissement === null && $load) {
            $this->getMapper()->loadRelated('FkEtablissementUniversite1', $this);
        }

        return $this->_Etablissement;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Universite
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Universite());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Universite::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdUniversite() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('id_universite = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdUniversite()));
    }
}
